import Http from "../../utils/HttpUtil";
import URL from "../URL";
export default{
    //查询个人接单信息
    //0我的派单 1我的接单
    async  SendSellSelectMySendSellList(userId,status,page=1){
        let url=URL.GetURL(URL.SendSellSelectMySendSellList);
        return await(Http.Get(url+`?userId=${userId}&status=${status}&page=${page}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //派单列表
    async  SendSellSelectSendSellList(userId,status,page=1){
        let url=URL.GetURL(URL.SendSellSelectMySendSellList);
        return await(Http.Get(url+`?userId=${userId}&status=${status}&page=${page}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
    
    //查看订单细节 
    //0发单者 1接单者
    async  SendSellSelectSendSellDetails(sendSellId,status){
        let url=URL.GetURL(URL.SendSellSelectSendSellDetails);
        return await(Http.Get(url+`?sendSellId=${sendSellId}&status=${status}`))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //取消订单
    async  SendSellCancelSendSell(sendSellId,userId){
        let url=URL.GetURL(URL.SendSellCancelSendSell);
        let para={
            sendSellId,
            userId
        };

        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },

    //接派单
    async  SendSellPlaceSell(sendSellId,userId,payPassword){
        let url=URL.GetURL(URL.SendSellPlaceSell);
        let para={
            sendSellId,
            userId,
            payPassword
        };

        return await(Http.Post(url,para))
        .then(response=>{
            return(response);
        },reject=>{
            return Promise.reject(reject);
        });
    },
}